﻿@namespace SwashbucklerDiary.Components
@inherits DialogComponentBase

<MultiDisplay>
    <MobileContent>
        <MMBottomSheet MyValue="Value"
                       MyValueChanged="ValueChanged">
            <MCard Class="rounded-t-lg py-2">
                <MList>
                    @foreach (var item in ListItemModels)
                    {
                        <MListItem OnClick="()=>OnClick(item.OnClick)">
                            <MListItemIcon>
                                <MIcon>
                                    @(item.Icon)
                                </MIcon>
                            </MListItemIcon>
                            <MListItemContent>
                                @(I18n.T(item.Text))
                            </MListItemContent>
                        </MListItem>
                        if (ListItemModels.Last() != item)
                        {
                            <MDivider></MDivider>
                        }
                    }
                    <MListItem>
                        <MButton Rounded="true"
                                 Block="true"
                                 Depressed="true"
                                 Large="true"
                                 Class="text-subtitle-1"
                                 OnClick="HandleOnCancel">
                            @(I18n.T("Share.Cancel"))
                        </MButton>
                    </MListItem>
                </MList>
            </MCard>
        </MMBottomSheet>
    </MobileContent>
    <DesktopContent>
        <MMDialog Value="Value"
                  ValueChanged="ValueChanged"
                  MaxWidth="420">
            <MCard Rounded="@("lg")">
                <MCardTitle Class="font-weight-bold">
                    @Title
                    <MSpacer></MSpacer>
                    <MButton Icon="true"
                             OnClick="HandleOnCancel">
                        <MIcon>mdi-close</MIcon>
                    </MButton>
                </MCardTitle>
                <MCardText>
                    @foreach (var item in ListItemModels)
                    {
                        <MListItem Class="px-0"
                                   OnClick="()=>OnClick(item.OnClick)">
                            <MListItemIcon Class="my-3">
                                <MIcon Class="list-item-icon">
                                    @(item.Icon)
                                </MIcon>
                            </MListItemIcon>
                            <MListItemContent>
                                <MListItemTitle>
                                    @(I18n.T(item.Text))
                                </MListItemTitle>
                            </MListItemContent>
                        </MListItem>
                    }
                </MCardText>
            </MCard>
        </MMDialog>
    </DesktopContent>
</MultiDisplay>
